package com.pms.mapper;

import com.github.pagehelper.Page;
import com.pms.dto.MailBoxPageQueryDTO;
import com.pms.dto.MailboxUpdateDTO;
import com.pms.entity.Mailbox;
import com.pms.vo.MailboxPageQueryVO;
import org.apache.ibatis.annotations.*;

@Mapper
public interface MailboxMapper {
    /**
     * 信箱新增
     * @param mailbox
     */
    @Insert("insert into mailbox(owner_id, content, status_id, create_time) " +
            "VALUES(#{ownerId},#{content},#{statusId},#{createTime})")
    void save(Mailbox mailbox);

    /**
     * 信箱分页查询
     * @param mailBoxPageQueryDTO
     * @return
     */
    Page<MailboxPageQueryVO> page(MailBoxPageQueryDTO mailBoxPageQueryDTO);

    /**
     * 信箱删除
     * @param id
     */
    @Delete("delete from mailbox where id=#{id}")
    void delete(Integer id);

    /**
     * 根据id查询信箱
     * @param id
     * @return
     */
    @Select("select * from mailbox where id=#{id}")
    Mailbox getById(Integer id);

    /**
     * 修改信箱
     * @param mailboxUpdateDTO
     */
    @Update("update mailbox set status_id=#{statusId} where id=#{id}")
    void update(MailboxUpdateDTO mailboxUpdateDTO);
}
